﻿@model GSOrganization.Application.SysRoleOutput
@{
    Layout = "~/Views/Shared/Create_Layout.cshtml";
}
<style>

</style>
<form class="layui-form" action="" lay-filter="layui">
    <input type="hidden" name="Id" id="Id" value="@Html.DisplayFor(model => model.Id)" />

    <div class="layui-form-item">
        <label class="layui-form-label required">名称</label>
        <div class="layui-input-inline">
            <input type="text" name="Name" required lay-verify="required" placeholder="请填写名称" autocomplete="off" class="layui-input" value="@Html.DisplayFor(model => model.Name)" />
        </div>
    </div>
 

    
     
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">描述</label>
        <div class="layui-input-block">
            <textarea name="Description" placeholder="请输入内容" class="layui-textarea">@Html.DisplayFor(model => model.Description)</textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">

            <button lay-submit lay-filter="formsubmit" class="common_btn" id="submit">提交</button>
            <div class="common_btn" onclick="return window.location.href='../SysRole'">返回</div>


        </div>
    </div>
</form>

<script>

    layui.use('form', function() {
        var form = layui.form;

        //监听提交
        form.on('submit(formsubmit)', function(data) {
            //获取checkbox数据,组装成数组!!!!!!
            var SysRoles = [];

            $('input[name="role"]:checked').each(function(index, domEle) {

                SysRoles.push($(this).val());
            });

            var entity = data.field;
            

            var data = ajaxPost("/SysRole/EditSysRole", entity);

            if (data.code == 200) {
                layer.alert(data.msg, {
                    title: "成功"
                });
                setTimeout(function() {
                    return window.location.href = '/SysRole'
                }, 2000);

            } else {
                layer.alert(data.msg, {
                    title: "失败"
                });
            }

            return false;
        });
    });

</script> 